﻿@{
    Layout = "";
}

<div class="box">
	<div class="box-header with-border">
		<h3 id="box-title" class="box-title"></h3>
		<span class="form-group mr15"></span><a href="./add" data-toggle="modal" class="btn btn-success pull-right">添加</a>
	</div>
	<div class="box-body">
		<div class="table-responsive">
			<form id="form_search">
				<div id="div_filter"></div>
			</form>
			<form id="form_list" action="./del" method="post">
				@Html.AntiForgeryToken()
				<input type="hidden" name="__callback" value="del_callback"/>
				<table id="GridView1" cellspacing="0" rules="all" border="1" style="border-collapse:collapse;" class="table table-bordered table-hover text-nowrap">
					<tr>
						<th scope="col" style="width:2%;"><input type="checkbox" onclick="$('#GridView1 tbody tr').each(function (idx, el) { var chk = $(el).find('td:first input[type=\'checkbox\']')[0]; if (chk) chk.checked = !chk.checked; });" /></th>

						<th scope="col">主键</th>
						<th scope="col">值</th>
						<th scope="col">备注</th>
						<th scope="col">创建时间</th>
						<th scope="col">更新时间</th>
						<th scope="col">逻辑删除</th>
						<th scope="col">排序</th>
						<th scope="col" style="width:5%;">&nbsp;</th>
					</tr>
					<tbody>
						@foreach(AdmConfig item in ViewBag.items) {
							<tr>

								<td><input type="checkbox" id="id" name="id" value="@item.Id" /></td>
								<td>@item.Id</td>
								<td>@item.Value</td>
								<td>@item.Remark</td>
								<td>@item.CreateTime</td>
								<td>@item.UpdateTime</td>
								<td>@item.IsDeleted</td>
								<td>@item.Sort</td>
								<td><a href="./edit?Id=@item.Id">修改</a></td>
                            </tr>
						}
					</tbody>
				</table>
			</form>
			<a id="btn_delete_sel" href="#" class="btn btn-danger pull-right">删除选中项</a>
			<div id="kkpager"></div>
		</div>
	</div>
</div>

@{
}
<script type="text/javascript">
	(function () {
		top.del_callback = function(rt) {
			if (rt.code == 0) return top.mainViewNav.goto('./?' + new Date().getTime());
			alert(rt.message);
		};

		var qs = _clone(top.mainViewNav.query);
		var page = cint(qs.page, 1);
		delete qs.page;
		$('#kkpager').html(cms2Pager(@ViewBag.count, page, 20, qs, 'page'));
		var fqs = _clone(top.mainViewNav.query);
		delete fqs.page;
		var fsc = [
			null
		];
		fsc.pop();
		cms2Filter(fsc, fqs);
		top.mainViewInit();
	})();
</script>